var pageName = null;

//点赞
function executePraise() {
    alert("赞一下！");
}

//多页面帮助
function openMultiPageHelp() {
    publishCustom(pageName + "$startGuide");
}

//单页面帮助
function openPageHelp() {
    Supp.Utils.publish(pageName, "startGuide", "");
}

//浮动窗口单击事件
function _popMenuClick(funcName, isSysMenu) {
    try {
        if (isSysMenu) {
            window[funcName].call(this);
        } else {
            Supp.Utils.publish(pageName, funcName);
        }
    } finally {
        closePopPage();
    }
};

appcan.ready(function() {
    var params = Supp.LocStorage.getVal(Supp.UI.ALIAS_MORE_MENU_POPOVER_MENUS);
    pageName = params.pageName;
    var menus = params.menu;
    var html = "";
    
    for (var i = 0; i < menus.length; i++) {
        if (menus[i].isToolbar) {
            html += "<li onclick='closePopPage();' class='skin-border-app-bottom'>关闭</li>";
            continue;
        }
        var className = "";
        if(menus[i].className){
            className = menus[i].className;
        }
        html += "<li class=\"" + className + "\" onclick=\"_popMenuClick('" + menus[i].click + "', " + (menus[i].isSys == true) + ")\"" 
            + " style=\"background-image:url(" + (menus[i].icon ? menus[i].icon : "") + ");\">"
            + menus[i].title 
            + "</li>";
    }
    $("#popMenu").append(html);
});

//关闭弹出层
function closePopPage() {
    appcan.window.closePopover("more_menu_popover"); 
}

//关闭弹出层页面
appcan.button(".urel", "", function() {
    closePopPage();
});